<?php
require_once "lib/init.php";

$tracks = user_list_tracks();

?>
<script src="js/functions._track.js" type="text/javascript" language="JavaScript"></script>
<form name="frmLogout" method="post" action="services.php" class="frmAjax" >
    Hello <?=$_SESSION['user']['email']?><input type="hidden" name="action" value="logout">
    <input type="submit" value="Logout">
</form>

<div id="counter" class='box'>
<form id="frmTrack" name="frmTrack" method="post" action="services.php">
    <input type="hidden" name="action" value="track.create">
    
    <input type="text" name="task_name" value="" id="task_name" size="60">
    <input type="button" name="task_start" value="" id="task_start">
</form>
</div>    
<script>
<?php 
foreach($tracks as $t){
    $name = $t['name'];
    $description = $t['description'];
    $start =  strtotime( $t['dt'] ) * 1000; // to milliseconds
    echo " addTrack('{$name}',new Date({$start}),'{$description}'); \n";
}
?>
_track_init();</script>


